<template>
  <div id="main">
    <div id="theLogin">
      <p>登录页面</p>
      <input type="text" name="username" id="username" v-model="username" placeholder="账号">
      <input type="password" name="password" id="password" v-model="password" placeholder="密码">
      <button @click="login">登录</button>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      username: 'admin',
      password: '123456'
    };
  },
  methods: {
    login() {
      if (this.username === 'admin' && this.password === '123456') {
        alert('登录成功!');
        this.$router.push('/StudentSystem');
      } else {
        alert('账号或密码错误,请重新输入!');
        this.username =null;
        this.password =null;
      }

    }
  }
}
</script>
<style scoped>
#main {
  width: 100%;
  display: flex;
  justify-content: center;
}

p {
  font-size: 18px;
  text-align: center;
}
</style>